int maxArea(int* height, int heightSize) {
    int right = heightSize - 1, left = 0;
    int max = 0;
    while (right > left) {
        int minHeight = height[left] < height[right] ? height[left] : height[right];
        if (max < minHeight * (right - left)) {
            max = minHeight * (right - left);
        }
        if (height[right] < height[left]) {
            right--;
        }
        else {
            left++;
        }
    }
    return max;
}